package com.example.demo.service.impl;

import com.example.demo.entity.GoodsImg;
import com.example.demo.mapper.GoodsImgMapper;
import com.example.demo.service.IGoodsImgService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mr.Xiayh
 * @since 2024-06-04
 */
@Service
public class GoodsImgServiceImpl extends ServiceImpl<GoodsImgMapper, GoodsImg> implements IGoodsImgService {

    @Autowired
    private GoodsImgMapper goodsImgMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean addGoodsImg(int goodsId,List<String> path) {
        for (String s : path) {
            goodsImgMapper.insertGoodsImg(goodsId,s);
        }
        return true;
    }
}
